package com.sportizz.sport;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;

public class Fb_dialog_box extends Dialog implements android.view.View.OnClickListener{

	Activity act;
	Button yes,no;
	String ticket_url;
	
	public Fb_dialog_box(Context context,String ticket_url) {
		super(context);
		this.act=(Activity) context;
		this.ticket_url=ticket_url;
	}

	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	    setContentView(R.layout.fb_dialog);
	    yes = (Button) findViewById(R.id.btn_fblogin);
	    no = (Button) findViewById(R.id.btn_cancel);
	    yes.setOnClickListener(this);
	    no.setOnClickListener(this);
	    
	}



	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		switch (v.getId()) {
	    case R.id.btn_fblogin:
	    	try
			{
			Uri uriUrl = Uri
					.parse(ticket_url);
			Intent launchBrowser = new Intent(
					Intent.ACTION_VIEW,
					uriUrl);
			act.startActivity(launchBrowser);
			}catch (Exception e) {
				Toast.makeText(act, "Check back later..", Toast.LENGTH_SHORT).show();
			}

	      break;
	    case R.id.btn_cancel:
	    	Log.i("suraj","no");
	      dismiss();
	      break;
	    default:
	      break;
	    }
	    dismiss();

	}

}
